<?php 
    if($type==1){
        $folder="game";
        $title_page = "Game";
        $controller ="fileGame";
        $icon_name="tenweb-icon-game.png";
        $id_field="gameId";
    }else{
        $folder="app";
        if($id==3){
            $icon_name="tenweb-icon-clip.png";
            $title_page = "Clip"; 
        }else{
            $icon_name="tenweb-icon-ungdung.png";
            $title_page = "App"; 
        }
        $id_field="appId";
        $controller ="fileApp";
    }                            
?>
<!-- box login --> 
<?php $this->renderPartial("application.views.layouts._menu");?>
<!-- end box login --> 
<div class="about">
    <?php $this->widget("BoxLogin");?>
    <h1><img class="kc_TB_td" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/<?php echo $icon_name; ?>"><span class="xanhdam" ><?php echo $title_page;  ?></span>
    </h1>

    <div class="Clip_2" style="margin-top: 5px;">
        <div class="Clip_2_left">
            <img width="90" height="87" alt="" src="<?php echo Common::getImage($data_detail['picture'],$folder,$data_detail['create_date'],''); ?>">
        </div>
        <div class="Clip_2_right">
            <strong class="font14 xanhdam"><?php echo $data_detail['title'] ?></strong><br>
            <?php echo $data_detail['introtext'] ?><br>
            <strong>Chia sẻ</strong> <a class="do"><?php echo $data_detail['percent_wapmaster']."%" ?></a>(Sms, Card)<br>
            Hỗ Trợ
            <?php if($data_detail['isJava']==1){ ?>
                <img width="15" height="15" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-Java.png">
                <?php } ?>
            <?php if($data_detail['isAndroid']==1){ ?>
                <img width="15" height="15" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-Androi.png">
                <?php } ?>
            <?php if($data_detail['isIos']==1){ ?> 
                <img width="15" height="15" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-Apple.png">
                <?php } ?>
            <?php if($data_detail['isRim']==1){ ?>
                <img width="15" height="15" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-Backbary.png">
                <?php } ?>
        </div>
        <div class="both"></div>

        <p><strong>Thông tin:</strong> <a class="xanhDV" href="<?php echo Url::createUrl("service/review",array("alias"=>$data_detail['alias'],"id"=>$data_detail['id'],"type"=>$type))?>"> Giới thiệu </a>  |  <a class="xanhDV" href="<?php echo Url::createUrl("home/eventDetail",array("id"=>$data_detail['id'],"alias"=>$data_detail['alias'])); ?>"> Sự kiện </a><br>Download: <a class="do"><?php echo $data_detail['download']; ?></a></p>

    </div>
    <h2><img class="kc_TB_td" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-linktaive.png">Link tải trực tiếp
    </h2>
    <div class="Clip_3">
        <strong class="xanh">Tự động trả về file cài tương thích với từng dòng máy điện thoại</strong><br>
        <textarea class="onhap_banner" style="overflow:hidden;" rows="1" cols="0" name="ma" onmousedown="this.select();" onclick="this.select();"><?php echo Common::sanitize_output(Yii::app()->params['base_url'].ltrim(Url::createUrl($controller.'/download',array($id_field=>$data_detail['id'],"userId"=>$_SESSION['userId'])),"/")) ?></textarea>
        <strong class="xanh">Link file ứng dụng:</strong><br>
        <?php if($data_detail['isJava']==1){ ?>
            <img width="17" height="22" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-Java.png"> Jar: <?php echo  Yii::app()->params['base_url'].ltrim(Url::createUrl($controller.'/download',array($id_field=>$data_detail['id'],"userId"=>$_SESSION['userId'],"extension"=>"jar")),"/")?><br>
            <img width="17" height="22" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-Java.png"> Jad: <?php echo  Yii::app()->params['base_url'].ltrim(Url::createUrl($controller.'/download',array($id_field=>$data_detail['id'],"userId"=>$_SESSION['userId'],"extension"=>"jad")),"/")?><br>
            <?php } ?>
        <?php if($data_detail['isIos']==1){ ?>
            <img width="17" height="22" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-Apple.png"> Ios: <?php echo  Yii::app()->params['base_url'].ltrim(Url::createUrl($controller.'/download',array($id_field=>$data_detail['id'],"userId"=>$_SESSION['userId'],"extension"=>"ipa")),"/")?>
            <br>
            <?php } ?>
        <?php if($data_detail['isAndroid']==1){ ?>
            <img width="17" height="22" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-APK.png"> Android: <?php echo  Yii::app()->params['base_url'].ltrim(Url::createUrl($controller.'/download',array($id_field=>$data_detail['id'],"userId"=>$_SESSION['userId'],"extension"=>"apk")),"/")?><br>
            <?php } ?>
        <strong class="xanh">Tải bằng cú pháp:</strong>
        <?php if($type==1){ ?>
        <p>Tải game: <strong class="do">MTAI G <?php echo  $id; ?> <?php echo $_SESSION['userId']; ?></strong> gửi <strong class="do">8055</strong> (500đ)</p>
        <?php } else { ?>
        <p>Tải game: <strong class="do">MTAI A <?php echo  $id; ?> <?php echo $_SESSION['userId']; ?></strong> gửi <strong class="do">8055</strong> (500đ)</p>
        <?php } ?>
    </div>
    <h2>
        <img width="20" height="19" class="kc_HT_td" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-manhung.png">Mã nhúng
    </h2>
    <?php for($i=1;$i<=5;$i++){ ?>
        <div class="Clip_4">
            <?php 
                $this->renderPartial("application.views.tool.tpl_display_code_tmp",array("item"=>$data_detail,"type"=>$i,"radio"=>0,"layout"=>array()));
                $html = $this->renderPartial("application.views.tool.tpl_display_code_tmp",array("item"=>$data_detail,"type"=>$i,"radio"=>0,"layout"=>array()),true);
                $html = Common::sanitize_output($html);
            ?> 

            <textarea style="margin-left: 5px" class="onhap_banner" rows="2" cols="0" name="ma" onmousedown="this.select();" onclick="this.select();"><?php echo Common::sanitize_output($html); ?></textarea>
        </div>
        <?php } ?>     


    <div class="BC_1">
        <form action="" method="post" name="form">
            <div class="BC_nd">
                <input type="text" class="box_BC" maxlength="15" name="content"><input type="submit" value="Gửi chat" class="button_BC" >
            </div>
        </form>
        <?php foreach($chat as $key=>$value){ ?>    
            <div class="BC_nd_1">
                <img width="16" height="16" class="kc_BC_td" alt="" src="<?php echo Yii::app()->params['static_url'];?>images/tenweb-icon-user-chat.png"><strong class="chu_user_chat"><?php echo $value['username'] ?>:</strong>&nbsp; <?php echo $value['content']; ?><br>
                <span>(<?php echo Common::genDate($value["create_date"]);?>) </span>
            </div>
            <?php } ?>
        <?php if(!empty($error)) { ?>
            <div class="APK">
                <p class="do"><strong>Thông báo:</strong> <?php echo $error;?></p>
            </div>
            <?php } ?>
        <div class="BC_nd_2">

            <?php if($numberPage > 1) { ?>


                <?php                         
                    $url = Url::createUrl("service/applicationDetail",array("alias"=>$data_detail['alias'],"id"=>$data_detail['id'],"type"=>$type));
                    $url1 = rtrim( $url, "/");
                    $url.="/";                      
                    echo Paging::show_paging_wap_user($numberPage, $currentPage, $url, $url1); 
                ?>


                <?php } ?> 

        </div>
    </div>
    <!-- box footer -->
    <?php $this->widget("BoxFooter");?>
    <!-- end box footer -->
</div>
